<template>
	<div>
		<el-dialog v-model="dialogVisible" :title="dialogTitle" v-bind="$attrs" :close-on-click-modal="false">
			<template #header="{ close, titleId, titleClass }">
				<slot name="header" :headerData="{ close, titleId, titleClass }"></slot>
			</template>
			<slot name="body"></slot>
			<template #footer>
				<slot name="footer"></slot>
			</template>
		</el-dialog>
	</div>
</template>

<script setup lang="ts">
import { Ref, ref, inject } from 'vue';
// 接收祖先组件传过来的值。来改变dialogVisible
const dialogVisible = inject<Ref<boolean>>('dialogVisible', ref(false));
interface dialogProps {
	dialogTitle: string;
}

// 默认值
withDefaults(defineProps<dialogProps>(), {});
// 也可以通过defineExpose暴露出去
defineExpose({
	dialogVisible
});
</script>

<style scoped></style>
